package com.tyl.xtk.config;

import cn.dev33.satoken.secure.SaSecureUtil;
import org.springframework.stereotype.Component;

/**
 * create by tyl at 2025/8/27
 */
@Component
public class PasswordEncoder {

    public String encode(CharSequence rawPassword) {
        return SaSecureUtil.sha256(rawPassword.toString());
    }

    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return SaSecureUtil.sha256(rawPassword.toString()).equals(encodedPassword);
    }
}
